{% extends 'base.html' %}

{% load bootstrap_pagination %}
{% load follow_tags %}

{% block main %}
    <main class="col-md-8 mb-1">
        <ul class="list-group">
            {% block post_list_head %}
                <li class="list-group-item">
                    <span class="pull-right">喜欢总数 {{ like_list.count }}</span>
                    <nav>
                        <a href="{% url 'forum:index' %}">django forum demo</a> >
                        <a href="{{ user.get_absolute_url }}">{{ user.nickname }}</a> >
                        <a>全部喜欢</a>
                    </nav>
                </li>
            {% endblock post_list_head %}

            {% for watch in page_obj %}
                <li class="list-group-item">
                    {{ watch|follow }}
                </li>
            {% empty %}
                <li class="list-group-item">你还没有喜欢什么</li>
            {% endfor %}
            {% if watch_list and paginator.num_pages > 1 %}
                {% bootstrap_paginate page_obj size='small' range=10 show_first_last='true' %}
            {% endif %}
        </ul>
    </main>
{% endblock main %}

{% block script %}
    <script>
        $(".unwatch-btn").click(function () {
            $.post($(this).attr("href"), {});
            $(this).parent().parent().parent().parent().remove();
            return false
        });
    </script>
{% endblock script %}